struct Solution {}

fn main() {}

impl Solution {
    pub fn hamming_weight(n: i32) -> i32 {
        let mut n_copy = n;
        let mut bit_list = vec![];
        while n_copy > 0 {
            bit_list.push(n_copy % 2);
            n_copy /= 2;
        }
        bit_list.iter().sum()
    }
}